<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>watch</title>
    <script src="vue.js"></script>
</head>
<body>
<div id="root">
 <h2>天气很{{info}}</h2>
<!--  //绑定事件时 @xxx=“yyyy” 可以写一些简单的语句-->
<!--  //@xxx时会找vm,所以window的功能无法执行-->
  <button @click="swi()">切换</button>
  <button @click="this.alert('ddd')">切换</button>

</div>
</body>

<script type="text/javascript">
  const vm = new Vue({
    el:'#root',
    data:{
      ishot:true
    },
    computed:{
      info(){
        return this.ishot? '热':'凉'
      }
    },
    methods:{
    swi(){
        this.ishot=!this.ishot
      }
    }
  })
</script>
</html>